package com.github.m6d21.sso.common.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *<p>
 *PhoneUtil
 *</p>
 *
 * @author liuyang
 * @date 2018/12/7 Fri 18:22:00
 * @since 1.0.0
 */
public class PhoneUtil {

    private final static String REGEXP = "^[\\d]{11}$";

    /**
     * 验证是否是11位数字
     *
     * @param phone 手机号
     * @return 验证结果
     */
    public static boolean checkPhone(String phone) {
        if(phone==null||phone.length()==0){
            return false;
        }
        Pattern pattern = Pattern.compile(REGEXP);
        Matcher matcher = pattern.matcher(phone);
        return matcher.matches();
    }
}
